package zuochengyun;

import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 * Created by shuowu on 2017/9/20.
 */
public class InfiniteSequence {

    public static void main(String[] args){
        Scanner scanner = new Scanner(new BufferedInputStream(System.in));
        while(scanner.hasNext()){
            long cur = scanner.nextLong();
            long sqrt = (long) Math.ceil(Math.sqrt(2 * cur));
            long left = 1;
            long right = sqrt;
            long middle = 0;
            long res = 0;
            while(left <= right){
                middle = (left + right) >> 1;
                System.out.println("middle: " + middle);
                long temp = (middle * middle + middle) / 2;
                if (temp < cur){
                   if((middle + 1) * (middle + 1) + (middle + 1) < 2 * cur){
                       left = middle + 1;
                   } else {
                       res = middle + 1;
                       break;
                   }
                } else if (temp == cur){
                    res = middle;
                    break;
                } else {
                    if((middle - 1) * (middle - 1) + (middle - 1) > 2 * cur){
                        right = middle - 1;
                    } else {
                        res = middle;
                        break;
                    }
                }
            }
            System.out.println(res);
        }
        scanner.close();
    }


}